package utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * @author: zhouyang
 * @descrpition: 受限于scanner的性能 有时会会tel 用这个自定义类不会
 * @time: 2019-10-08 16:24
 */
public class InputUtils {
    static class CustomizedReader {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer;

        CustomizedReader(InputStream source) {
            reader = new BufferedReader(new InputStreamReader(source));
            tokenizer = new StringTokenizer("");
        }

        public String next() {
            while (!tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }


        public int nextInt() {
            return Integer.parseInt(next());
        }



        public double nextDouble() {
            return Double.parseDouble(next());
        }



        public double nextLong() {
            return Long.parseLong(next());
        }



        public double nextFloat() {
            return Float.parseFloat(next());
        }

    }
}
